from ui.layout import Horizontal, Vertical
from ui.widget import CellWidget

class NodeListView(ni.View):
    node_name = ni.String(allowed_chars=list("[a-z|A-Z]"))
    create = ni.Trigger(name="+")
    node_list = ni.List(item_type=ni.Node)
    
    def __widgets__(self):
        return {'node_list':CellWidget,
                'create':Button,
                'node_name':LineEdit}
    
    def __layout__(self):
        return Horizontal(self.node_list, Vertical(self.node_name, self.create))
    
    def on_create(self):
        cmds.new_type(self.node_name)
        
    

